package com.cgbl.cg.adapter

import android.os.Bundle
import com.alibaba.fastjson.JSON
import com.cgbl.cg.R
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.robot.base.configs.AppConstants
import com.robot.base.model.CollectDetailBean
import com.robot.base.util.arouter.ARouterUtil
import com.robot.base.utils.pic.ImageLoaderUtils

class DiscoveryCollectionAdapter :
    BaseQuickAdapter<CollectDetailBean, BaseViewHolder>(R.layout.app_item_discovery_collection) {
    override fun convert(holder: BaseViewHolder, item: CollectDetailBean) {
        holder.setText(R.id.item_tv_num, item.followCount)
            .setText(R.id.item_tv_content, item.collectName)
        holder.itemView.setOnClickListener {
            ARouterUtil.goToActivityWithBundle(AppConstants.Router.COLLECTION.A_COLLECTIONS_DETAILS,
                Bundle().apply {
                    putString(
                        AppConstants.BundleKey.COLLECTION_DATA,
                        item.collectId
                    )
                }
            )
        }

        ImageLoaderUtils.displayRound(
            context,
            holder.getView(R.id.item_iv_img),
            item.collectImages,
            6
        )
    }
}